<template>
    <el-container>
      <el-aside width="230px">
    <div class="sidebar-logo-container">
      <img src="https://slwl-admin.itheima.net/static/img/logo.58dd185e.png">
    </div>
        <el-menu
          default-active="1"
          class="el-menu-vertical-demo"
          active-text-color="#ff7a63"
          :collapse-transition="false"
          :unique-opened="true"
          @open="handleOpen"
          @close="handleClose">
          <el-submenu
            :index="item.id+''"
            v-for="item in menuList"
            :key="item.id"
          >
            <template #title>
              <i :class="menuIcon[item.id]" class="ic"></i>
              <span>{{ item.name }}</span>
            </template>
            <el-menu-item-group v-for="sonItem in item.children" :key="sonItem.id">
              <el-menu-item :index="sonItem.id+''">{{ sonItem.name }}</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>
          <el-row type="flex" >
            <el-col>
              <span style="font-size: 16px; color: rgb(42, 41, 41); font-weight: bold;">工作台</span>
            </el-col>
            <el-col>
              <el-row type="flex" justify="end">
                  <div>
                  管理员
                  </div>
              </el-row>
            </el-col>
          </el-row>
        </el-header>
        <el-main>Main</el-main>
      </el-container>
    </el-container>
</template>

<script>

export default {
  name: 'dashboardPage',
  data () {
    return {
      menuList: [],
      menuIcon: {
        '996012789342433537': 'el-icon-s-home',
        '996013586302137537': 'el-icon-s-data',
        '1013825825621851521': 'el-icon-truck',
        '1013826500665722913': 'el-icon-s-custom',
        '996014431324372769': 'el-icon-tickets',
        '996014596043080033': 'el-icon-rank'

      }
    }
  },
  created () {
    this.menuList = this.$store.state.user.menu
    // console.log(this.menuList)
  }
}
</script>

<style lang="scss" scoped>
.el-aside {
  background-color: #fff;
  color: #333;
  height: 100vh;
  text-align: center;
  .sidebar-logo-container{
    padding: 20px 20px 0;
    img{
      width: 152px;
      height: 113px;
    }
  }
  .el-menu{
    text-align: left;
    background-color: #fff;
    .ic{
      color: #ff7a63;
      margin-right: 10px;
      font-size: 20px;
    }
  }
}
.el-header{
  background-color:#f3f4f7 ;
  padding-top: 25px;
}
.el-main{
  background-color:#f3f4f7 ;
}
</style>
